﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace WpfControlLibrary.Converts
{
    /// <summary>
    /// 根据连接状态，调整背景颜色
    /// </summary>
    [ValueConversion(typeof(States),typeof(Brush))]
    public class OnOffButtonsStateConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            States states = (States)value;
            if (states == States.OFF)
            {
                return Brushes.Red;
            }
            else
            {
                return Brushes.Green;
            }
            //throw new NotImplementedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
